#
# Ruby Soul - Ruby Embedded Parsing/Lexing using DSL techniques.
#
# Copyright (c) 2008 - Giancarlo Bellido. All Rights Reserved.
#
#
module Soul
  
  module Matches
    
    LOWER = ('a'..'z')
    UPPER = ('A'..'Z')
    ALPHA = LOWER.to_a + UPPER.to_a
    DIGIT = ('0'..'9')
    ALNUM = ALPHA + DIGIT.to_a
    XDIGIT = DIGIT.to_a + ('a'..'f').to_a + ('A'..'F').to_a
    BLANK = [' ', "\t"]
    BDIGIT = ('0'..'1')
    
    def lower
      return Soul::Match.new LOWER  
    end
    
    def upper
      return Soul::Match.new UPPER
    end
    
    # Matches any letter
    def alpha
      return Soul::Match.new ALPHA
    end
    
    def digit
      return Soul::Match.new DIGIT
    end
    
    def bdigit
      return Soul::Match.new BDIGIT
    end
    
    def alnum
      return Soul::Match.new ALNUM
    end
    
    def xdigit
      return Soul::Match.new XDIGIT
    end
    
    def blank
      return Soul::Match.new BLANK
    end
    
    def ch (what)
      return Soul::Match.new(what)
    end
  end  
end
